import { createSlice } from "@reduxjs/toolkit";

const countSlice = createSlice({
  //命名空间
  name:'counter',
  //初始状态
  initialState:{
    count:0
  },
  reducers:{
    increment(prev,action){
      // console.log(increment,'increment');
      prev.count += action.payload

    },
    decrement(prev,action){
      prev.count -= action.payload
    }
  }

})

export default countSlice.reducer
console.log(countSlice.reducer,'countSlice.reducer');
export const {increment,decrement} = countSlice.actions
// console.log(increment,'increment');


